#include "../app/app_message.h"
#include <stdio.h>
#include "log/log.h"
#include <string.h>

int main(int argc, char const *argv[])
{

    char *json = "{\"conn_type\":1, \"id\":\"4455\",\"msg\":\"4F4B00\"}";
    Message *msg = app_message_initByJson(json);
    
    char buff[100];
    int len = app_message_toBinary(msg, buff, 100);
    log_info("binary:%s, len: %d", buff, len);

    Message *msg2 = app_message_initByBinary(buff, len);
    char buff2[100];
    app_message_toJson(msg2, buff2, 100);
    log_info("json:%s", buff2);
    
    return 0;
}
